package cn.huiyunche.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.huiyunche.base.service.interfaces.IndexService;
import cn.huiyunche.base.service.vo.Result;
import cn.huiyunche.tools.basic.exceptions.BusinessException;

@Controller
@RequestMapping("/index")
public class IndexController {
	
	@Autowired
	private IndexService indexService = null;
	
	private IndexService getIndexService() {
		return indexService;
	}
	
	/**
	 * 查询订单数量／车辆数
	 * 
	 * @param params
	 * @return
	 * @throws BusinessException
	 */
	@ResponseBody
	@RequestMapping(value = "/countandamount", method = RequestMethod.GET)
	public Result<Object> selectCountAndAmount(String params) throws Exception{
		Result<Object> result = new Result<Object>(true, null, "查询成功");
		result.setData(this.getIndexService().selectCountAndAmount(params));
		return result;
	}
	
	/**
	 * 查询调度统计
	 * 
	 * @param params
	 * @return
	 * @throws BusinessException
	 */
	@ResponseBody
	@RequestMapping(value = "/schedule", method = RequestMethod.GET)
	public Result<Object> selectSchedule(String params) throws Exception{
		Result<Object> result = new Result<Object>(true, null, "查询成功");
		result.setData(this.getIndexService().selectSchedule(params));
		return result;
	}
	
}
